mv2adc
Converts millivolt values to Analogue to Digital Converter count values.
Contents
Syntax
Y = mv2adc(X, voltageRange, maxValue)
Description
mv2adc(X, voltageRange, maxValue) returns an Analogue to Digital Converter count value corresponding for the input value X scaled according to the voltage range specified.
Example
X = [-500, -250, 0, 250, 500];
voltageRange = 1000; % ±1 V range
maxValue = 32512;
Y = mv2adc(X, voltageRange, maxValue)
Y = 1×5 int32 row vector -16256 -8128 0 8128 16256
Input Arguments
- X - the raw ADC value(s), (scalar, vector or matrix of real, finite with no NaN (Not a Number) elements)
- voltageRange - the voltage range used for the channel (positive, non-zero integer scalar value, in millivolts)
- maxValue - the maximum ADC value corresponding to the resolution for the device (positive, non-zero integer scalar value)
The units for voltageRange can be changed e.g. volts.
Output Arguments
- Y - the converted values (scalar, vector or matrix of 32-bit integers; in millivolts).
Note: If a different unit is used for the input X, then Y will have the corresponding units.
See Also
Copyright: © 2015 Pico Technology Ltd. All rights reserved.